layout | author | title | subTitle | date | categories | tags | bigimg | img | desc | series | toc | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
post |
Van Schandevijl Wouter |
The itenium Slack Meme Bot® : Implementation |
How was the Slack Meme Bot implemented? |
2023-07-04 |
javascript |
|
|
|
Technical implementation details for the Slack Meme Bot
|
slack-meme-poster |
|
How does the Slack Meme Bot work, technically?
The docker-compose
exists of two services
halverneus/static-file-server
makes the memes accessible from the internet.
The Slack WebHook sends just the url of the meme, after which Slack attempts to
download the image before actually posting it.
If Slack cannot download the image, nothing will show up in your Slack channel.
You will probably need to configure the meme file accessibility.
chmod -R 755 memes_dir
The Dockerfile
copies the job
folder with the Node program to the docker container
and then runs start.sh
which schedules running slack-meme-poster.js
and starts the Cron daemon.
The slack-meme-poster.js
selects a random file from your MEMES_DIR
and moves it to
a already-sent
subfolder to make sure no meme is ever posted twice.
It then sends the meme url to Slack using the WebHook and 🎉, meme posted!
Configure the actual Slack message
messageToPostWithMeme
: A simple string sent along with the meme- Configure the entire Slack message using the Slack Block Kit Builder